package com.exporter.listeners;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFileChooser;
import javax.swing.JTextField;

public class DestinationFolderActionListener implements ActionListener {

        private Component parent;
        JTextField txtDestFolder;
        public DestinationFolderActionListener(Component parent, JTextField txtDestFolder)
        {
                this.parent = parent;
                this.txtDestFolder = txtDestFolder;
        }
        
        @Override
        public void actionPerformed(ActionEvent ae) {
                JFileChooser chooser = new JFileChooser();
                chooser = new JFileChooser();
                chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                if (chooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
                        txtDestFolder.setText(chooser.getSelectedFile().getAbsolutePath());
                        txtDestFolder.setToolTipText( txtDestFolder.getText() );
                }
        }

}
